﻿using System;
using System.Collections.Generic;
using System.Data.SQLite;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 天离终端防火墙_专业版.TL_Hanllder
{
    /// <summary>
    /// 将日志记录到数据库
    /// </summary>
    public class TL_LogsqlIte_Hanllder
    {
        /// <summary>
        /// 连接sqlite数据库
        /// </summary>
        public static string SqliteClient(string client)
        {
            // 获取本地数据库
            TL_Servies.TL_SqlInfo_Serives.TL_SqlClient();
            string sql = TL_Api.TL_SqlInfo_Api.SqlDb;
            SQLiteConnection cliect = new SQLiteConnection(sql);
            try
            {
                // 连接数据库
                cliect.Open();
            }
            catch (Exception ex)
            {
                // 抛出异常日志
                TL_Api.TL_SqlInfo_Api.SqlErrorEx = ex.ToString();
            }
            return client;
        }
        public static string TL_FindSystemConfig()
        {
            // 先连接数据库
            SqliteClient(TL_Api.TL_SqlInfo_Api.A1);
            string sql = "select * form TL_System where id = '1'";
            using (SQLiteCommand cmd = new SQLiteCommand(sql))
            {
                while (true)
                {
                    var code = cmd.ExecuteReaderAsync();
                    // 使用可变字符串写入数据
                }
            }

        }
    }
}
